//
//  TicTacViewController.h
//  TicTacToe
//
//  Created by Tim on 09-11-22.
//  Copyright 2009 Tim Dimsdale. All rights reserved.
//
// This file is part of TicTacToe.
// 
// TicTacToe is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// 
// TicTacToe is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with TicTacToe.  If not, see <http://www.gnu.org/licenses/>
//

#import <Cocoa/Cocoa.h>
#import <QTKit/QTKit.h>
#import "TicTacGrid.h"
#import "TicTacModel.h"
#import "TicTacNotifications.h"
#import "TicTacPosition.h"

/*!
 \brief	The main visualization view that draws the tic tac peices
 
 */
@interface TicTacView : NSView {
	/*! The grid peice itself.
	 Currently most drawing is delegated to the grid. 	 
	 */
	TicTacGrid *myGrid;
	
	/*!
	 The model used internally as a reference while drawing.
	 */
	TicTacModel *ticTacModel;
	/*!
	 If active, then the view will respond to the human or computer.
	 If not active the view grid will be grayed out, and not allow interaction.
	 */
	bool isActive;
}

/*!
 \brief Given a mouse position in the view, returns the equivalent tic tac toe position 
 \param point The graphic point within the view
 \return the tic tac toe position within the grid
 
 */
-(TicTacPosition*) gridIndexAtPoint : (NSPoint) point;

/*!
 \brief Starts a new game in the context of the view.
 */
- (void)newGame;

/*!
 \brief sets the data model to use when drawing tic tac toe
 \param model the tic tac model
 */
- (void)setModel: (TicTacModel*)model;

/*! \brief refreshs the screen */
- (void)updateDisplay;

/*! \brief Used internally in the view to decide what to do when a human has done something
	\param event The event related to what the human did.  
 */
- (void)dealWithHuman:(NSEvent*)event;

/*!
 \brief set whether or not the view is active.  If not active the view will not respond to input, and will gray out the grid.
 \param active true if to allow interactivity
 */
- (void)setIsActive:(bool)active;

@end
